﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Account_Login : System.Web.UI.Page
{
    //string historyURL = "";//历史URL，登录成功直接到达先前的页面。
    protected void Page_Load(object sender, EventArgs e)
    {
        //historyURL = Request.Url.ToString();
        //RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
    }
    protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
    {
        bool Authenticated = false;
        Authenticated = SiteLevelCustomAuthenticationMethod(LoginUser.UserName, LoginUser.Password);
        e.Authenticated = Authenticated;
        if (Authenticated == true)
        {
            Session["username"] = LoginUser.UserName;
            Session["pwd"] = LoginUser.Password;
            Response.Redirect("~/NickInfo.aspx");
        }
    }

    private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
    {
        TB.BLL.UserName user = new TB.BLL.UserName();
        return user.CheckUserName(UserName,Password);
    }
}
